﻿using JGSY.SerialCommunication.UpperComputer.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JGSY.SerialCommunication.UpperComputer.IComponent
{
    /// <summary>
    /// 通信单元
    /// </summary>
    public interface ICommunicationUnit
    {

        /// <summary>
        /// 连接超时
        /// </summary>
        public int ConnectTimeOut {  get; set; }

        /// <summary>
        /// 打开
        /// </summary>
        public Result<bool> Open(int timeOut);

        /// <summary>
        /// 关闭连接
        /// </summary>
        public void Close();

        /// <summary>
        /// 发送接收报文
        /// </summary>
        public Result<byte> SendAndRecevice(List<byte> request,int receviceLen,int errorLen); 
    }
}
